package com.qinghong.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.Transactional;

@Component
public class UserService2 {

    @Autowired
    JdbcTemplate jdbcTemplate;

    @Autowired
    PlatformTransactionManager transactionManager;

    @Transactional
    public void transfer3(){
        jdbcTemplate.update("update user set money = ? where username = ?",9,"zhangsan");
        int i = 1/0;
    }
}
